@include('admin.public.__head')
    <!-- Main Container -->
    <div class="main-container container-fluid">
        <!-- Page Container -->
        <div class="page-container">

            <!-- Page Sidebar -->
            @include('admin.public.__left')
            <!-- /Page Sidebar -->
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                        <li class="active">
                            <i class="fa fa-home"></i>&nbsp;评论管理
                        </li>
                        <li>评论列表</li>
                    </ul>
                </div>
                <!-- /Page Breadcrumb -->
                <!-- Page Body -->
                <div class="page-body">
                	<div class="row">
                		<div class="col-xs-12">
                			<div class="widget">
                				<div class="widget-header">
                					<span class="widget-caption">评论列表</span>
                					<div class="widget-buttons">
                						{!!strTostr($comments->links())!!}
                					</div>
                				</div>
                				<div class="widget-body">
                					<table class="table table-hover table-bordered">
                						<thead>
                							<tr>
                								<th>ID</th>
                								<th>评论文章</th>
                								<th>评论者</th>
                								<th>评论内容</th>
                								<th>操作</th>
                							</tr>
                						</thead>
                						<tbody>
                                            @foreach ($comments as $vo)
                							<tr>
                								<td>{{$vo->id}}</td>
                								<td>{{$vo->articles->title}}</td>
                								<td>{{$vo->members->nickname}}</td>
                								<td>{{$vo->content}}</td>
                								<td>
                									<a href="#" class="btn btn-danger btn-xs comment-del" dataid="{{$vo->id}}">删除</a>
                								</td>
                							</tr>
                                            @endforeach
                						</tbody>
                					</table>
                				</div>
                			</div>
                		</div>
                	</div>
                </div>
                <!-- /Page Body -->
            </div>
            <!-- /Page Content -->

        </div>
        <!-- /Page Container -->
        <!-- Main Container -->

    </div>

    @include('admin.public.__js')
    <script>
        $('.comment-del').click(function () {
            var id = $(this).attr('dataid');
            layer.confirm('确定删除吗？', {
                title:'删除评论',
                icon:3
            }, function (index) {
                layer.close(index);
                $.ajax({
                    url:"{{url('admin/commentdel')}}",
                    type:'post',
                    data:{id:id},
                    dataType:'json',
                    success:function (data) {
                        if (data.code == 1) {
                            layer.msg(data.msg, {
                                icon:6,
                                time:2000
                            }, function () {
                                location.href = data.url;
                            });
                        }else {
                            layer.open({
                                title:'删除失败',
                                content:data.msg,
                                icon:5,
                                anim:6
                            });
                        }
                    }
                });
            });
            return false;
        });
    </script>
</body>
<!--  /Body -->
</html>
